﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace ModBot.ConfigBuilder.CustomControls
{
    public partial class ScriptBuilderControl : UserControl
    {
        public ScriptBuilderControl()
        {
            InitializeComponent();
                
        }

        public string GetScriptLines()
        {
            string[] textLines = scriptRichtextbox.Text.Split('\n');
            string commandLineFormat = "C{0}={1}";

            StringBuilder output = new StringBuilder();

            output.AppendLine(String.Format("Commands={0}", textLines.Length));
            for (int i = 0; i < textLines.Length; i++)
            {
                if (textLines[i].Length > 0)
                {
                    output.AppendLine(string.Format(commandLineFormat, i + 1, textLines[i].Replace("\r", "")));
                }
            }

            return output.ToString();
        }






    }
}
